<%--
    Document   : ConsultaProfissao
    Created on : May 29, 2011, 12:36:20 AM
    Author     : diogo
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>




<script type="text/javascript">

	var cArea = null;
	var CurrentOnloadFunction = window.onload;

	
	/**
	 * instancia o ajax pra area
	 */
	function createCArea(){
		cArea = new AjaxConnection("consultas/Area.jsp");
		cArea.setOutput(document.getElementById("output_area"));
		cArea.OnResponseReceive = function(){
			onChangeAreaCodArea();
		}
	}

	// verifica para criar funcao sem sobrescrever
	if (CurrentOnloadFunction != null ) {
		
		window.onload = function(){
			CurrentOnloadFunction();
			createCArea();
		}
	}
	else {
		
		window.onload = function(){
			createCArea();
		}
	}
	/*
	var cArea = null;
	var CurrentOnloadFunction = window.onload;


	window.onload = function(){
		if (CurrentOnloadFunction !== null) {
			CurrentOnloadFunction();
		}
		cArea = new AjaxConnection("consultas/Area.jsp");
		cArea.setOutput(document.getElementById("output_area"));
	}
	//*/

	// botao consultar
	function consultarArea(){
		cArea.setParameter("filtro_tipo_area", document.getElementById("filtro_tipo_area").value);
		cArea.setParameter("DescricaoArea", document.getElementById("filtro_area").value);
		cArea.startConnection();
	}
</script>


Area: <input id="filtro_area">
<button id="goo" onclick="consultarArea();"> Consultar</button>

<!--Set accelerator-->
<script type="text/javascript">
	window.onkeydown =
		function(){
			if (event.keyCode == 13) {
				consultarArea();
			}
		}
</script>
<!--ja carrega -->
<script type="text/javascript">
	//window.onload = function () {alert(2);setTimeout(consultar, 1500);};
	setTimeout(consultarArea, 1500);
	cArea.SetLoading();
</script>

<!--
<div id="output_area">

</div>
-->